public class FactoryPatternDemo {
    public static void main(String[] args) throws Exception {

        HumanFactory humanFactory = new HumanFactory();
        Human human = humanFactory.createHuman("male");
        human.eat();
        human.sleep();
        human.beat();

        Human female = HumanFactory.createFemale();

        female.eat();
        female.sleep();
        female.beat();
    }
}


interface Human {
    void eat();

    void sleep();

    void beat();
}


class Male implements Human {

    @Override
    public void eat() {
        System.out.println("male eat");
    }

    @Override
    public void sleep() {
        System.out.println("male sleep");
    }

    @Override
    public void beat() {
        System.out.println("male beat");
    }
}

class Female implements Human {

    @Override
    public void eat() {
        System.out.println("female eat");
    }

    @Override
    public void sleep() {
        System.out.println("female sleep");

    }

    @Override
    public void beat() {
        System.out.println("female beat");

    }
}

